package com.shilei.state;

/**
 * @description:  有心情 不同的心情下 调用的 方法也不一样
 * @author: 81271
 * @date: 2020-04-25 11:42
 */
public class MM {
    State state;

    public MM(State state) {
        this.state = state;
    }

    void cry () {
        state.cry();
    }


    void smile () {
        state.smile();
    }

}

class main {
    public static void main(String[] args) {
        MM mm = new MM(new HappyState());
        mm.cry();
        mm.smile();
    }
}

class HappyState extends State {

    @Override
    void cry() {
        System.out.println("happyCry");
    }

    @Override
    void smile() {
        System.out.println("happySmile");
    }
}
